var transactionIDCamera = "";


var camera = null;
function initCamera(){
    try {
        		camera = nokia.device.load("camera");
    } 
    catch (e) {
        var error = e.toString();
        alert(error);
    }
}


/*
Starts the device camera, showing the camera user interface, and 
assigns callBack function onCameraStart.
*/
function startCamera(){
    try {
        var transactionIDCamera = camera.startCamera(onCameraStart);
    } 
    catch (e) {
        var error = e.toString();
        alert(error);
    }
    
}


/*
onCameraStart function calls display method and passes outPut containing
taken pictures array(urls) as parameter


Function is invoked asynchronously after the user takes a picture. 
The point where the callback is invoked is implementation dependent since 
camera UI's differ in how pictures are handled, but it should be called at the point 
where the image is initially stored or otherwise disposed of. 
However, in an implementation where the calling browser/runtime is suspended 
while the viewfinder is running, the callback cannot be invoked after each shutter press and 
must be invoked after the viewfinder exits. 
In order to handle multiple pictures in a single callback, the callback 
picture parameter is specified as an array. 
*/
function onCameraStart(outPut){
    try {
            showImages(outPut);
    } 
    catch (e) {
        var error = e.toString();
        alert(error);
    }
    
}

function onCameraStartError(err){
        alert(err.toString());
}
